package main

import (
	"context"
	"fmt"

	"github.com/apache/rocketmq-client-go/v2/primitive"

	"github.com/apache/rocketmq-client-go/v2/admin"
)

func main() {
	// TODO 检查topic是否存在, 如果不存在就新建, 没有找到检查topic的接口
	// 不知道admin.WithResolver(primitive.NewPassthroughResolver([]string{"127.0.0.1：1234"}))这个参数是什么意思, 但是传12345会报错
	testAdmin, err := admin.NewAdmin(admin.WithResolver(primitive.NewPassthroughResolver([]string{"127.0.0.1：1234"})))
	err = testAdmin.CreateTopic(
		context.Background(),
		admin.WithTopicCreate("newTopic2"),
		admin.WithBrokerAddrCreate("120.24.67.46:10911"),
	)

	if err != nil {
		fmt.Println("err", err)
	}
}
